from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

from app.envConfig import ENV_CONFIG

engine = create_engine(ENV_CONFIG.BIGDATA_DATABASE_URL, echo=True, pool_recycle=3600, pool_pre_ping=True)
# engine = create_engine("hive://192.168.48.16:10000/ads")
# 创建 Session 工厂
SessionLocal = sessionmaker(bind=engine)

# teacher_management
teacher_management_sessionLocal = sessionmaker(
    bind=create_engine(ENV_CONFIG.TEACHER_MANAGEMENT_DATABASE_URL, echo=True, pool_recycle=3600, pool_pre_ping=True))

szh_info_sessionLocal = sessionmaker(
    bind=create_engine(ENV_CONFIG.SZH_INFO_DATABASE_URL, echo=True, pool_recycle=3600, pool_pre_ping=True))

szh_management_sessionLocal = sessionmaker(
    bind=create_engine(ENV_CONFIG.SZH_MANAGEMENT_DATABASE_URL, echo=True, pool_recycle=3600, pool_pre_ping=True))

local_teaching_management_sessionLocal = sessionmaker(
    bind=create_engine(ENV_CONFIG.LOCAL_TEACHING_MANAGEMENT_DATABASE_URL, echo=True, pool_recycle=3600,
                       pool_pre_ping=True))
